//
//  GHChongZhiRecordCell.m
//  GodHorses
//
//  Created by Mac on 2017/11/16.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "GHTixianRecordCell.h"
@interface GHTixianRecordCell()
@property(nonatomic, strong) STButton                     *tixianButton;
@property(nonatomic, strong) STButton                     *timeButton;
@property(nonatomic, strong) STButton                     *statusButton;
@property(nonatomic, strong) STLabel                      *outPutLable;//提现多少
@property(nonatomic, strong) STLabel                      *timeLable;//时间
@property(nonatomic, strong) STLabel                      *desLable;//成功否
@end
@implementation GHTixianRecordCell

+ (CGFloat)CellHeight{
    return 120;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
#pragma mark --subView
- (void)configSubView{
    self.backgroundColor = [UIColor whiteColor];
    
    self.tixianButton = [[STButton alloc] initWithFrame:CGRectMake(15, 16, 100, 20)
                                                    title:@"提现"
                                               titleColor:GH_firstTextColor
                                                titleFont:15
                                             cornerRadius:0
                                          backgroundColor:nil
                                          backgroundImage:nil
                                                    image:[UIImage imageNamed:@"PC_zhanghumingxi"]];
    self.tixianButton.titleEdgeInsets = UIEdgeInsetsMake(0, 8, 0, 0);
    self.tixianButton.st_centerY = 22;
    [self addSubview:self.tixianButton];
    
    
    self.outPutLable = [[STLabel alloc] initWithFrame:CGRectMake(0, 16, 200, 20)
                                                text:@"- 3000"
                                           textColor:GH_YellowBackGroundColor
                                                font:18
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentRight];
    self.outPutLable.st_right = UIScreenWidth - 15;
    self.outPutLable.st_centerY = 22;
    [self addSubview:self.outPutLable];
    
    //line
    UIView * line = [[UIView alloc] initWithFrame:CGRectMake(0, 44, UIScreenWidth, 0.5)];
    line.backgroundColor = GH_lineColor;
    [self addSubview:line];
    
    self.timeButton = [[STButton alloc] initWithFrame:CGRectMake(15, line.st_bottom + 13, 100, 20)
                                                  title:@"提现时间"
                                             titleColor:GH_firstTextColor
                                              titleFont:15
                                           cornerRadius:0
                                        backgroundColor:nil
                                        backgroundImage:nil
                                                  image:[UIImage imageNamed:@"PC_time"]];
    self.timeButton.titleEdgeInsets = UIEdgeInsetsMake(0, 8, 0, 0);
    [self addSubview:self.timeButton];
    
    self.timeLable = [[STLabel alloc] initWithFrame:CGRectMake(0, line.st_bottom + 13, 300, 15)
                                               text:@"2017-09-21 13:21:05"
                                              textColor:GH_secendTextColor
                                                   font:13
                                            isSizetoFit:NO
                                          textAlignment:NSTextAlignmentRight];
    self.timeLable.st_right = UIScreenWidth - 15;
    [self addSubview:self.timeLable];
    

    
    self.statusButton = [[STButton alloc] initWithFrame:CGRectMake(15, 9 + _timeButton.st_bottom, 100, 20)
                                                  title:@"状态"
                                             titleColor:GH_firstTextColor
                                              titleFont:15
                                           cornerRadius:0
                                        backgroundColor:nil
                                        backgroundImage:nil
                                                  image:[UIImage imageNamed:@"PC_state"]];
    self.statusButton.titleEdgeInsets = UIEdgeInsetsMake(0, 8, 0, 0);
    [self.statusButton setImage:[UIImage imageNamed:@"PC_state_red"] forState:UIControlStateSelected];
    [self addSubview:self.statusButton];
    
    self.desLable = [[STLabel alloc] initWithFrame:CGRectMake(0, 9 + _timeButton.st_bottom, 300, 15)
                                              text:@"提交成功"
                                         textColor:GH_secendTextColor
                                              font:14
                                       isSizetoFit:NO
                                     textAlignment:NSTextAlignmentRight];
    self.desLable.st_right = UIScreenWidth - 15;
    self.desLable.st_centerY = self.statusButton.st_centerY;
    [self addSubview:self.desLable];
}
- (void)setModel:(GHTixianRecordModel *)model{
    _model = model;
    
    self.outPutLable.text = [NSString stringWithFormat:@"￥%@(%@)",model.money,model.remark];
    
    NSDate * date = [NSDate dateWithTimeIntervalSince1970:[model.create_time integerValue]].st_localDate;
    
    self.timeLable.text = date.st_yyyyMMddhhmmssWithDate;
    
    self.statusButton.selected = YES ?model.status == 1:NO;
    
    self.desLable.text = model.statusString;
}
@end

